[WIP] [NO-MERGE] Make "unique" flag more robust and update access enforcement opts to make use of it. #32877
Closed
zoecarver wants to merge 7 commits intoswiftlang:masterfrom
Closed
[WIP] [NO-MERGE] Make "unique" flag more robust and update access enforcement opts to make use of it. #32877zoecarver wants to merge 7 commits intoswiftlang:masterfrom
zoecarver wants to merge 7 commits intoswiftlang:masterfrom
Conversation
Adds a new flag to alloc_ref instructions. This flag, "unique", signifies that the reference is unique meaning it is not stored elsewhere and may not be written to elsewhere. This means accesses of this reference may be "static" instead of "dynamic". Uniqueness of the reference is enforced by the SILVerifier. This is good because it may be run between each pass so errors will be easy to track down. Currently the SILVerifier only supports a very few cases where it can prove uniqueness, all other cases will end in an error. Later this verifier check may be extended to be more robust. Currently the only way to mark a reference as unique is through textual SIL. Later optimization passes may be added or updated to add this information.
…erence information and update AccessEnforcementOpts to promote accesses of unique storage to static access enforcement.
Contributor
Author
|
@swift-ci please benchmark. |
Contributor
|
Build failed before running benchmark. |
* Recurrsive functions / BB * Empty functions
Contributor
Author
|
@swift-ci please benchmark. |
Contributor
Author
|
@swift-ci please benchmark |
Contributor
Performance: -O
Code size: -O
Performance: -Osize
Code size: -Osize
Performance: -OnoneCode size: -swiftlibsHow to read the dataThe tables contain differences in performance which are larger than 8% and differences in code size which are larger than 1%.If you see any unexpected regressions, you should consider fixing the Noise: Sometimes the performance results (not code size!) contain false Hardware Overview |
Member
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is a WIP PR to get a benchmark of the performance improvements of access enforcement opts when it promotes uniquely identified storage accesses to statically enforced accesses.
I'm not sure to what degree
AccessedStorage::isUniquelyIdentifiedis used throughout the optimizer. I wouldn't be supprised if this PR doesn't have any meaningful performance gains. I think another pass that just updated accesses of "unique" references might be much more beneficial (performance-wise). We'll see.Later, I'll clean up these individual commits and break each one into its own PR. The tests do not currently pass, this PR is just for benchmarking.
Refs (and based on) #32844. Related forum post.